package com.pactera.mavenweb.batch;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.batch.item.ItemWriter;

import com.pactera.mavenweb.domain.BatchReport;

public class BatchCustomWriter implements ItemWriter<BatchReport> {
	
	private String name;
	private int age;
	private List hobby;
	private Map  friends;
	private Set  set;
	private boolean ifMarried;
	
	public BatchCustomWriter(String name, int age,List hobby,Map friends,Set    set,boolean ifMarried){  
		this.name = name;
		this.age = age;
		this.hobby = hobby;
		this.friends = friends;
		this.set = set;
		this.ifMarried = ifMarried;
	}  
	
	public String getInfo(){  
		
		String info = "姓名："+this.name+"\n年龄:"+this.age+"\n爱好:"+this.hobby+"\n朋友:"+this.friends+"\n婚否:"+this.ifMarried+"\n其他的："+this.set;
		return info;
	}  
	
//	private String from;
	
//	@Override
	public void write(List<? extends BatchReport> items) throws Exception {

		System.out.println("writer..." + items.size());
		for(BatchReport item : items){
			System.out.println(item);
		}
		
		System.out.println(getInfo());
		
	}
}